#include	<stdio.h>
#include	<stdlib.h>

int main( int argc, char** argv )
{
  FILE* fstream;
  int N;
  double *A;
  int i;
  int ierr;

  fstream = fopen("b.dat", "rb");

  ierr = fread( &N, sizeof(int), 1, fstream );
  printf("ierr = %d\n", ierr);
  A = (double*)malloc(sizeof(double)*N);
  ierr = fread( A, sizeof(double), N, fstream );
  printf("ierr = %d\n", ierr);
  

  printf("N = %d\n", N);

  for( i = 0; i < N; i++ )
  {
    printf("%f\n", A[i]);
  }

  free(A);

  fclose(fstream);

}
